package com.xiaoma.base.trycatch;

/**
 * @author maj
 * @ClassName Test1
 * @Description
 * @date 2020-09-28 15:35
 */
public class Test1 {

  static class Container{
    String s="def";
  }

  static Container test(int a){
    Container con=new Container();
    try{
      if(a==0){
        throw new RuntimeException();
      }
      return con;
    }catch(RuntimeException e){
      con.s="catch";
      return con;
    }finally{
      con.s="finally";
    }
  }


  public static void main(String[] args) {
    Container c=test(0);
    System.out.println(c.s);
    c=test(1);
    System.out.println(c.s);
  }
}
